package com.cloud.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * 操作日志记录表 sys_oper_log
 *
 * @author yzj
 */
@Data
@Schema(name = "操作日志对象", description = "系统管理")
@TableName("sys_oper_logs")
public class SysOperLogs {

    @TableId(value = "oper_id", type = IdType.AUTO)
    private Long operId;

    @Schema(description = "系统编号")
    private String sysCode;

    @Schema(description = "操作模块")
    @Excel(name = "操作模块", orderNum = "1", width = 15)
    private String title;

    @Schema(description = "业务类型（0其它 1新增 2修改 3删除 4导出）")
    @Excel(name = "业务类型", orderNum = "2", width = 10, replace = {"其它_0", "新增_1", "修改_2", "删除_3", "导出_4"})
    private Integer businessType;

    @Schema(description = "请求方法", hidden = true)
    @Excel(name = "请求方法", orderNum = "3", width = 15)
    private String method;

    @Schema(description = "请求方式", hidden = true)
    @Excel(name = "请求方式", orderNum = "4", width = 15)
    private String requestMethod;

    @Schema(description = "操作设备", hidden = true)
    @Excel(name = "操作设备", orderNum = "5", width = 10, replace = {"电脑端_pc", "移动端_app", "微信端_wx"})
    private String operDevice;

    @Schema(description = "操作人员")
    @Excel(name = "操作人员", orderNum = "6", width = 15)
    private String operName;

    @Schema(description = "部门名称", hidden = true)
    @Excel(name = "部门名称", orderNum = "7", width = 15)
    private String deptName;

    @Schema(description = "请求Url", hidden = true)
    @Excel(name = "请求Url", orderNum = "8", width = 30)
    private String operUrl;

    @Schema(description = "操作IP", hidden = true)
    @Excel(name = "操作IP", orderNum = "9", width = 15)
    private String operIp;

    @Schema(description = "请求参数", hidden = true)
    @Excel(name = "请求参数", orderNum = "10", width = 15)
    private String jsonParam;

    @Schema(description = "返回参数", hidden = true)
    @Excel(name = "返回参数", orderNum = "11", width = 30)
    private String jsonResult;

    @Schema(description = "操作时间", hidden = true)
    @Excel(name = "操作时间", orderNum = "12", width = 15, format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date operTime;

    @Schema(description = "业务类型集合（0其它 1新增 2修改 3删除）")
    @TableField(exist = false)
    private List<String> businessTypes;

    @Schema(description = "开始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private String beginTime;

    @Schema(description = "结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private String endTime;

}
